package com.yidu.verycd_reception.controller;

import com.yidu.verycd_reception.entity.VerycdComment;
import com.yidu.verycd_reception.service.VerycdCommentService;
import com.yidu.verycd_reception.util.BaseMessage;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * (VerycdComment)表控制层
 *
 * @author makejava
 * @since 2020-07-27 09:57:00
 */
@RestController
@RequestMapping("verycdComment")
public class VerycdCommentController {
    /**
     * 服务对象
     */
    @Resource
    private VerycdCommentService verycdCommentService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public VerycdComment selectOne(Integer id) {
        return this.verycdCommentService.queryById(id);
    }

    @RequestMapping("findAll")
    @ResponseBody
    public Map<String,Object> findAll(VerycdComment comment){
        return verycdCommentService.queryAllByLimit(comment);
    }

    /**
     * 增加
     * @param
     * @return
     */
    @RequestMapping("add")
    @ResponseBody
    public BaseMessage insert(VerycdComment commentVo){
        BaseMessage po = verycdCommentService.insert(commentVo);


        return po ;
    }
    /**
     *删除
     * @param comId
     * @return
     */
    @RequestMapping("delete")
    @ResponseBody
    public BaseMessage delete(Integer comId){
        BaseMessage flag = verycdCommentService.delete(comId);

        return flag;

    }

}